/**
 *
 */
import instance from "@/services/axios";
/**
 *  加密
 */
import { cryptoPwd } from "@/utils/index";



/**
   * 登录
   * @param username 用户名，应为字符串类型
   * @param password 密码，应为字符串类型
   * @returns 返回包含登录状态、消息等信息的对象，类型为LoginResponse
   */
async function login(username, password) {
    // 时间戳
    const timestamp = +new Date();
    /**
     * 请求接口
     */
    const { status, message, msg } = await instance.post(
        "login",
        {
            userName: username,
            password: cryptoPwd(password, timestamp),
        },
        {
            headers: {
                timestamp,
            },
        }
    );
    return { status, message, msg };
}



export default {
    login,
};
